package com.tca.spring.framework.learning.ioc.beans;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.InitializingBean;

import javax.annotation.PostConstruct;

/**
 * @author zhouan
 * @Date 2021/1/21
 */
@Data
@Slf4j
public class Student implements InitializingBean{

    public Student() {
        log.info("Student构造器方法被执行了");
    }

    public Student(Long id, String name) {
        log.info("Student构造器方法被执行了");
        this.id = id;
        this.name = name;
    }

    /**
     * id
     */
    private Long id;

    /**
     * name
     */
    private String name;

    @PostConstruct
    public void postConstructor() {
        log.info("执行 postConstructor 方法");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        log.info("执行 InitializingBean 接口的 afterPropertiesSet方法");
    }

    public void initMethod() {
        log.info("执行@Bean的initMethod 方法");
    }
}
